home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / security / portmap_3.shar.Z / portmap_3.shar / README < prev    next >
Encoding:
Text File  |  1993-11-20  |  7.9 KB  |  202 lines

  1. @(#) README 1.5 93/11/21 21:25:34
  2.  
  3. This is the README file for the 3rd enhanced portmapper release.
  4.  
  5. Description
  6. -----------
  7.  
  8. This README describes a replacement portmapper with access control in
  9. the style of the tcp wrapper (log_tcp) package and a handful of other
  10. enhancements.  The portmapper provides a simple mechanism to discourage
  11. access to the NIS (YP), NFS, and other services registered with the
  12. portmapper.
  13.  
  14. Like all portmappers, this one is intended to be started at boot time.
  15. Daemons that offer RPC services tell the portmapper on what port they
  16. listen. Unlike the well-known services registered with the inetd, RPC
  17. network port numbers may change each time the system is booted.
  18. Whenever a client wants to use an RPC service it is supposed to first
  19. ask the portmapper on what port the corresponding daemon is listening.
  20. The rpcinfo command can tell you what RPC services your system offers.
  21.  
  22. As described in the features section below, the replacement portmapper
  23. can prevent undesirable client-server interactions.  In some cases,
  24. better or equivalent alternatives are available:
  25.  
  26.     The SunOS portmap that is provided with patch id 100482-02 should
  27.     close the same security holes.  In addition, it provides NIS
  28.     daemons with their own access control lists. This is better than
  29.     just portmapper access control.
  30.  
  31.     The "securelib" shared library (eecs.nwu.edu:/pub/securelib.tar)
  32.     implements access control for all kinds of (RPC) services, not
  33.     just the portmapper.
  34.  
  35.     Reportedly, Irix 4.0.x already has a secured portmapper.
  36.  
  37. However, vendors still ship portmap implementations that allow anyone
  38. to read or modify its tables and that will happily forward any request
  39. so that it appears to come from the local system.
  40.  
  41. Features
  42. --------
  43.  
  44. - optional: host access control. The local host is always considered
  45. authorized. Access control requires the libwrap.a library that comes
  46. with recent tcp wrapper (log_tcp) implementations.
  47.  
  48. - requests to change the portmap tables are accepted only when they
  49. come from the local system.
  50.  
  51. - optional: requests to (un)register services that listen on privileged
  52. ports (port < 1024) are accepted only when the requests themselves come
  53. from a privileged port. This feature is optional because of older RPC
  54. implementations.
  55.  
  56. - requests that are forwarded by the portmapper will be forwarded
  57. through an unprivileged port.
  58.  
  59. - the portmapper refuses to forward requests to rpc daemons that do (or
  60. should) verify the origin of each request: when the portmapper forwards
  61. a request it appears to come from the local machine. At present, the
  62. portmapper refuses to forward all RPC calls to itself, and most RPC
  63. calls to the NFS mountd/nfsd daemons, and to the NIS daemons.
  64.  
  65. Restrictions
  66. ------------
  67.  
  68. Limiting access to the portmapper does not protect you from direct
  69. attacks on the rpc daemons; the main task of portmap is to maintain a
  70. table of available RPC services and of the network ports that they are
  71. listening on. The securelib can be used to protect individual RPC
  72. daemons, and the latest SunOS portmap+NIS fix already protects the NIS
  73. daemons and implements limited forwarding.
  74.  
  75. On the other hand, even though a portmapper with access control only
  76. makes an attack more difficult, it still provides an excellent early
  77. warning system.
  78.  
  79. Origin and portability
  80. ----------------------
  81.  
  82. The sources in this distribution are derived from code on the second
  83. BSD networking tape, which was derived from Sun's RPCSRC 4.0 code, and
  84. from Sun's TIRPC (transport-independent rpc) distribution. 
  85.  
  86. The code compiles fine with SunOS 4.1.x, Ultrix 4.x and ESIX System V
  87. release 4.0, but I expect it will work with many other UNIX flavours.
  88. Tested with SunOS 4.1.1; an earlier version was also tested with Ultrix
  89. 3.0.  SysV.4 uses a different program that the portmapper, however;
  90. rpcbind is the name, and it can do much more than the old portmapper.
  91.  
  92. Installation
  93. ------------
  94.  
  95. (1) Follow the instructions in the Makefile, then build the portmap and
  96. auxiliary executables.
  97.  
  98. (2) Before killing the present portmap process, save the present
  99. portmapper tables using the command:
  100.  
  101.     ./pmap_dump >table
  102.  
  103. If you kill the portmap process without saving its tables you will have
  104. to reboot the machine.
  105.  
  106. Note: the information in the portmap tables is dynamic: For example, it
  107. will be different after each reboot. On a Sun, it even changes each
  108. time a windowing system is started that uses the selection service.
  109.  
  110. (3) Kill the running portmap process and start the new portmap
  111. program.  Then (still as root) initialize the portmap tables with:
  112.  
  113.     ./pmap_set <table
  114.  
  115. (4) If you get error messages of the form: "not registered: xxxx",
  116. disable the CHECK_PORT feature in the Makefile, remove pmap_check.o and
  117. rebuild the portmap program.  Then proceed with step 3.
  118.  
  119. In order to revert to the original portmap daemon, kill off the running
  120. one, restart the original one and reload its tables using the
  121. "pmap_set" command as shown above.
  122.  
  123. Access control:
  124. ---------------
  125.  
  126. By default, host access control is enabled. However, the host that runs
  127. the portmapper is always considered authorized. The host access control
  128. tables are never consulted with requests from the local system itself;
  129. they are always consulted with requests from other hosts.
  130.  
  131. In order to avoid deadlocks, the portmap program does not attempt to
  132. look up the remote host name or user name, nor will it try to match NIS
  133. netgroups. The upshot of all this is that only network number patterns
  134. will work for portmap access control.
  135.  
  136. Sample entries for the host access-control files are:
  137.  
  138.     /etc/hosts.allow:
  139.     portmap: your.sub.net.number/your.sub.net.mask
  140.     portmap: 255.255.255.255 0.0.0.0
  141.  
  142.     /etc/hosts.deny
  143.     portmap: ALL: (/some/where/safe_finger -l @%h | mail root) &
  144.  
  145. The syntax of the access-control files is described in the
  146. hosts_access.5 manual page that comes with the tcp wrapper (log_tcp)
  147. sources.  The safe_finger command comes with later wrapper releases.
  148.  
  149. The first line in the hosts.allow file permits access from all systems
  150. within your own subnet; some rpc services rely on broadcasts and will
  151. contact your portmapper anyway; and once an intruder has access to your
  152. local network segment you're already in deep trouble.
  153.  
  154. The second line in the hosts.allow file may be needed if there are
  155. any PC-NFS systems on your network segment.
  156.  
  157. For security reasons, the portmap process drops root privilegs after
  158. initialization. The access control files should therefore be readable
  159. for group or world.
  160.  
  161. Testing:
  162. --------
  163.  
  164. Normally, only rejected requests will be reported via the syslog
  165. daemon.  Logging is done in a child process, in order to avoid
  166. possible deadlock in case the logging code needs assistance from
  167. the portmapper.
  168.  
  169. By default, the portmapper will be utterly silent. In fact, the portmap
  170. daemon is not consulted that often. Sending a SIGINT signal to the
  171. portmap process will enable the logging of all requests. 
  172.  
  173. Another way to enable verbose logging is to start the daemon with the
  174. "-v" option. See above, steps (2) and later, on how to stop and restart
  175. the portmapper without having to reboot.
  176.  
  177. Warning:  with some HP-UX versions, when verbose logging is on, the
  178. system fills up with zombie processes. This can be fixed by compiling
  179. with -DIGNORE_SIGCHLD (see instructions in the Makefile).
  180.  
  181. With verbose logging turned on, requests such as "ypcat" or "rpcinfo
  182. -p" should show up with log file entries such as:
  183.  
  184.  MMM dd hh:mm:ss hostname portmap[pid]: connect from x.x.x.x to getport(ypserv)
  185.  MMM dd hh:mm:ss hostname portmap[pid]: connect from y.y.y.y to dump()    
  186.  
  187. Send SIGINT to the portmapper to turn the verbose logging off.
  188.  
  189. Acknowledgements
  190. ----------------
  191.  
  192. Casper H.S. Dik (casper@fwi.uva.nl) provided valuable information on
  193. RPC security and tested an intermediate version of the portmapper with
  194. SunOS 4.1.2.  Lyford D. Rich (rich@ece.nps.navy.mil) was helpful with
  195. porting the daemon to Ultrix 3.x. Lionel Cons (cons@dxcern.cern.ch)
  196. solved the HP-UX problem.
  197.  
  198.     Wietse Venema (wietse@wzv.win.tue.nl)
  199.     Mathematics and Computing Science
  200.     Eindhoven University of Technology
  201.     The Netherlands
  202.